<?php
    @header("Content-Type:text/html;charset=utf-8");

    @include_once("conn.php");  
    @include_once("common.php");

    if(!( isset($_POST["username"]) && isset($_POST["pwd"]) )){
        paramsErr();
    }
 
    $username = $_POST["username"];
    $pwd = $_POST["pwd"];

    
    $sql = "select * from  myadmin where username = '$username'";
    $result = mysqli_query($conn,$sql);

    $obj = array();
    if($result){ 

        $item = mysqli_fetch_assoc($result);
        if($item){ 
            
            if($pwd  ==  $item["pwd"]){
                $obj["status"] = true;
                $obj["msg"] = "登陆成功!";
                // $obj["data"] = $item;
            }else{
                $obj["status"] = false;
                $obj["msg"] = "用户名或密码有误!";
            }

        }else{
            $obj["status"] = false;
            $obj["msg"] = "该用户未注册";
        }
    }else{
        $obj["status"] = false;
        $obj["msg"] = "sql语句有误";
        $obj["sql"] = $sql;
    }
    echo json_encode($obj);




?>